// Class Game, controlls the information of the game and runs the gameLoop
// Authors: Matthew DeNovio

#ifndef GAME
#define GAME
#include "Camera.h"	//Must be first because of <window.h>
#include <conio.h>
#include "Point.h"
#include "World.h"
#include "Character.h"
#pragma comment(lib, "winmm.lib");	// Used to get time in Milliseconds


class Game
{
public:
	Game(void);
	~Game(void);
	void startUpGame();

private:

	// Attributes	
#pragma region Attributes

	static enum gamestate { openworld, battle, paused, dialogue };			// Keeps track of the Various Game states
	U8 _currentGameState;													// Current Game State
	Camera _gameCamera;														// Camera 

	static enum locations { mainworld, cave, house};						// Keeps track of the Various Locations Available
	U8 _currentLocation;													// Current Location in the World

	World _gameWorld;														// Game World Object

	bool _bVisualChanges;													// Boolean to check for any visual changes on the screen

	Character _player;														// Player Character		

	Point _shiftAmount;														// Amount that the Camera is shifting
	bool _bShiftCamera;														// Check if the Camera needs to shift

	I8 amtMoved;


	// Time

	U16 currentTime;													// Current Time
	U16 pastTime;														// Last recorded time
	U16 dt;																// difference in times

	static const U16 SECOND = 500;										// value of 1 second

	// Input Time
	U16 waitTime;
	static const U16 INPUT_WAIT = SECOND;								// 500 = 1sec		5000 = 10sec

	// Scroll Time
	U16 scrollWaitTime;					
	static const U16 SCROLL_WAIT =	INPUT_WAIT / Camera::TILE_DIM;		// Scroll last as long as wait for input


#pragma endregion

	// functions
#pragma region Functions

	// Game Loop Functions
	void playGame();

	// Update Time
	void updateTime();

	// Get Input
	void getInput();
	bool checkKeyBoardState(U8 key);

	// Update Game
	void updateGame();

	// Draw Game
	void drawGame();

	void createWorld();
	void displayBoard();

	void moveCharacter();
	void drawCharacter();

	bool checkCameraBoundrys();

	bool tileWalkable();



#pragma endregion

};

#endif

